<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>预约时间</title>
    <%@ include file="/main/main_css.jsp" %>
    <%@ include file="/main/main_js.jsp" %>
    <script src="JS/Print.js"></script>
    <script src="JS/main.js"></script>
</head>
<body>
    <!--  -->
    <div class="all-wrapper">
        <div class="row com-header text-center">
            <span>鹰潭市行政服务中心</span>
        </div>
        <div class="row main-content time-table">
        	<div class="row" >
                <div class="time-count pull-right">
                   <span>剩余</span> <span id="time" class="text-red"></span> <span>秒</span>
                </div>
            </div>
            <div class="col-md-24">
                <h1>预约成功</h1>
            </div>
            <div class="col-md-24" style="margin-left: 40%">
                <h3>预约受理号：${ORDER_NO }</h3>
            </div>
            <div class="col-md-24" style="margin-left: 40%">
            	 <h3>二维码小票：</h3><img width="270px" height="270px" alt="" src="data:image/png;base64,${base64 }">
            </div>
        </div>
        <input type="hidden" id="ewm" value="${QR_INFO }"/>
        <div class="row footer">
            <a class="btn btn-success btn-lg" href="loginOut" role="button"><i class="fa fa-reply"></i>返回首页</a>
            <a class="btn btn-primary btn-lg" href="javascript:void(0);" id="orderList" role="button">查看预约<i class="fa fa-hand-pointer-o"></i></a>
            <a class="btn btn-primary btn-lg" href="javascript:void(0);" onclick="printQrs();" role="button">打印预约信息<i class="fa fa-hand-pointer-o"></i></a>
        </div>
    </div>
    <script type="text/javascript">
	    $('#orderList').on('click',function(){
	        var index = layer.load(3, {
	            shade: [0.3,'#000'] //0.1透明度的白色背景  
	        });
	        setTimeout(function(){
	            layer.close(index);
	        },10000);
	        $(this).attr("href","/smartTerminal/getMyAppointmentList?ORDER_NO=${ORDER_NO }&currentpage=1&pagesize=7");
	    });
    </script>
    <script src="static/js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
    	//打印预约号
	    function printQrs() {
	    	var po = [{
	    			"alignType":1,			//布局方向（0：居左，1：居中，2：居右）
	    			"textSize":1,			//大小
	    			"info":"预约受理号：\n${ORDER_NO }\n\n\n\n",	//打印的文字或二维码内容
	    			"cutPaperType":0,			//是否切纸（0：不切纸，1：切纸）
	    		}];
	    	var data = JSON.stringify(po);
	    	var isQrs = false;
	    	send_command(
	    			"printerPrintInfo",      // 打印信息方法名
	    		    data,                       // 传递需打印的信息
	    		    function (status) {
	    				var json = JSON.parse(status);
	    				if(json.status == 100){
	    					isQrs = true;
	    				}
	    			} 
	    		);
	    	if(isQrs){
	    		printerSQ();
	    	}
	    }
    	
    	//打印二维码
    	function printerSQ(){
    		var ewm = $("#ewm").val();
    		var qr = {"qrString": ewm, "cutPaperType": 1, "alignType": 1, "QRwidth": 6, "printer_choose": 1};
    		var data = JSON.stringify(qr);
    	    send_command(
    	        "printerPrintQr",
    	        data,
    	        function (status) {
    	        	var json = JSON.parse(status);
    				if(json.status == 100){
    					
    				}
    	        });
    	}
    
    </script>
     <form id="loginOut" action="loginOut"></form>
</body>
<!-- 添加动画 -->
<script type="text/javascript">
	//加入倒计时
	var count =  119;
	function countdown(){
		$("#time").text(count);
		if(count > 0){
			window.setTimeout("countdown()",1000);
			count --;
		}else{
			$("#loginOut").submit();
		}
	}
	countdown();    
	
	var index = layer.load(3, {
	    shade: [0.3,'#000'] //0.1透明度的白色背景  
	});
	setTimeout(function(){
	    layer.close(index);
	},500);


</script>
</html>
